<template>
	<view class="page">
		<view class="logo">
			<image src="/static/app/logo.png" mode=""></image>
		</view>
		<a :href="url" class="btn">
			点击下载APP
		</a>
		<view class="mask" v-show="isShow"></view>
		<view class="guide" v-show="isShow">
			<image src="/static/app/arrow.png" mode=""></image>
			<view class="title">请在浏览器打开</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShow:false,
				url:'',
				logo:''
			};
		},
		onShow() {
			this.getData();
		},
		onLoad() {
			this.is_wx();
		},
		methods:{
			is_wx() {
				let self = this;
				let en = window.navigator.userAgent.toLowerCase()
				// 匹配en中是否含有MicroMessenger字符串
				if (en.match(/MicroMessenger/i) == 'micromessenger') {
					self.isShow = true;
				}
				if (en.match(/MicroMessenger/i) != 'micromessenger') {
					// alert("不在微信", 2222)
				}
			},
			getData() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._get('index/getAppDownload', {}, function(res) {
					self.logo = res.data.logo;
					self.url = res.data.url;
					uni.hideLoading();
				});
			}
		}
	}
</script>

<style lang="scss">
	@import 'download-app.scss';
</style>
